#include <cstdio>
#include <cstring>
#include <set>
#include <iostream>
#include <algorithm>
#define maxn  200200
using namespace std;
long long int tree[maxn];
long long a[maxn];
long long te[maxn];
int ans[maxn];
multiset <long long> st;
multiset <long long > :: iterator it;
multiset <long long > :: iterator tt;
int main()
{
	int t;
	scanf("%d",&t);
	printf("*****\n");
	while(t--)
	{
		int n,m;
		memset(tree,0,sizeof(tree));
		scanf("%d %d",&n,&m);
		for(int i = 1;i<=n;i++)
		{
		//printf("***\n");
			scanf("%d",&a[i]);
			tree[i] += tree[i-1]+a[i];
		}
		memset(ans,0,sizeof(ans));
		st.clear();
		for(int i = 1;i<=n;i++)
		{
			long long  sum = tree[i];
			if(sum<=m) ans[i] = 0;
			else 
			{
				long long temp = sum;
				for(it = st.end();it!=st.begin();it--)
				{
					tt = it;
					temp -= *(--tt);
					ans[i]++;
					if(temp<=m) break;
				}
			}
			st.insert(a[i]);
		}
		for(int i = 1;i<=n;i++)
		{
			if(i==1) printf("%d",ans[i]);
			else printf(" %d",ans[i]);
		}
		printf("\n");
	}
}
